import 'dart:async';
import 'dart:typed_data';

import 'package:flutter/foundation.dart';
import 'package:wechat_kit/wechat_kit.dart';

class WechatUtils {
  static Future<bool> isInstalled(Wechat wechat) {
    return wechat.isInstalled();
  }

  static Future<void> registerApp(
    Wechat wechat, {
    @required String appId,
    @required String universalLink,
  }) {
    return wechat.registerApp(
      appId: appId,
      universalLink: universalLink,
    );
  }

  static Future<void> shareWebpage(
    Wechat wechat, {
    int scene = WechatScene.SESSION,
    String title,
    String description,
    Uint8List thumbData,
    @required String webpageUrl,
  }) {
    return wechat.shareWebpage(
      scene: scene,
      title: title,
      description: description,
      thumbData: thumbData,
      webpageUrl: webpageUrl,
    );
  }

  static Future<void> pay(
    Wechat wechat, {
    @required String appId,
    @required String partnerId,
    @required String prepayId,
    @required String package,
    @required String nonceStr,
    @required String timeStamp,
    @required String sign,
  }) {
    return wechat.pay(
      appId: appId,
      partnerId: partnerId,
      prepayId: prepayId,
      package: package,
      nonceStr: nonceStr,
      timeStamp: timeStamp,
      sign: sign,
    );
  }
}
